clear 

** read in .dta file **

use "${clean}/who_counts_analysis.dta", clear

** Event Study plot, Alt. Dichotimization, 1945-1962 **

gen byte D = (FOR_MAX == 1)
gen `:type year' Dyear = cond(D, YOB, 1950)

reghdfe MOB b1950.Dyear ec_total, absorb(Arabic Female geo2_ma YOB reg_fe) cluster(geo2_ma) noconstant
matrix list e(b)
label variable Dyear "year"

honestdid, pre(1/5) post(7) mvec(0.5(0.5)2)
honestdid, coefplot cached title("DiD Max,Registration")
graph save "${output}/graphs/MOB_HDID_MAX.gph", replace
graph export "${output}/graphs/MOB_HDID_MAX.png", replace

reghdfe Schooling b1950.Dyear ec_total, absorb(Arabic Female geo2_ma YOB reg_fe) cluster(geo2_ma) noconstant
matrix list e(b)
label variable Dyear "year"

honestdid, pre(1/5) post(7) mvec(0.5(0.5)2)
honestdid, coefplot cached title("DiD Max,Formal Schooling")
graph save "${output}/graphs/Schooling_HDID_MAX.gph", replace
graph export "${output}/graphs/Schooling_HDID_MAX.png", replace

reghdfe EDU_YRS b1950.Dyear ec_total, absorb(Arabic Female geo2_ma YOB reg_fe) cluster(geo2_ma) noconstant
matrix list e(b)
label variable Dyear "year"

honestdid, pre(1/5) post(7) mvec(0.5(0.5)2)
honestdid, coefplot cached title("DiD Max,Formal Schooling, Years")
graph save "${output}/graphs/YRS_HDID_MAX.gph", replace
graph export "${output}/graphs/YRS_HDID_MAX.png", replace

reghdfe French_Lit b1950.Dyear ec_total, absorb(Arabic Female geo2_ma YOB reg_fe) cluster(geo2_ma) noconstant
matrix list e(b)
label variable Dyear "year"

honestdid, pre(1/5) post(7) mvec(0.5(0.5)2)
honestdid, coefplot cached title("DiD Max, French Literacy")
graph save "${output}/graphs/LIT_HDID_MAX.gph", replace
graph export "${output}/graphs/LIT_HDID_MAX.png", replace

** Output Graphs **

graph combine "${output}/graphs/MOB_HDID_MAX.gph" "${output}/graphs/Schooling_HDID_MAX.gph" "${output}/graphs/YRS_HDID_MAX.gph" "${output}/graphs/LIT_HDID_MAX.gph"
graph save "${output}/graphs/Honest_MAX.gph", replace
graph export "${output}/graphs/Figure12A.png", replace

